import request from "@/utils/request";
import { Page } from "@/types/page";
import { Content } from "@/types/content";

export interface ContentPageParams {
  page: number;
  pageSize: number;
  categoryId?: string;
  type?: number;
  menuId?: string;
}

export function getContentDetail(id: string) {
  return request.post<Content>(`/api/client/contents/detail`, { id });
}

export function viewContent(contentId: string) {
  return request.post("/api/client/contents/view", { contentId });
}

export function favoriteContent(contentId: string) {
  return request.post("/api/client/contents/favorite", { contentId });
}


export const listContents = (params: ContentPageParams) => {
  return request.post<Page<Content>>("/api/client/contents/page", params);
};